package study.io.springboot.upload.support.utils;

import java.net.URL;
import java.util.List;
import java.util.stream.Collectors;

public class URLUtils {

    public static List<URL> toURLs(List<String> urlLt) {
        return urlLt.stream()
                .map(URLUtils::newURL)
                .collect(Collectors.toList());
    }

    public static URL newURL(String url) {
        URL _url;
        try {
            _url = new URL(url);
        } catch (Exception ex) {
            throw new RuntimeException("new url error!", ex);
        }
        return _url;
    }
}
